package com.create404.suishoupai.utils;

import java.util.Random;

/**
 * TODO
 *
 * @author Stephana
 * date 2021/7/21 15:48
 * @version 1.0
 */
public class SaltUtil {

    public static String getSalt(int n) {

        char[] chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890!@#$%^&*()".toCharArray();
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < n; i++) {
            char aChar = chars[new Random().nextInt(chars.length)];
            sb.append(aChar);
        }
        return sb.toString();
    }

    public static void main(String[] args) {
        String salt = getSalt(8);
        System.out.println(salt);
    }
}
